import request from '@/utils/request'

const getAdministorList = (page, limit, key) => {
  return request('/administor/list', {
    method: 'get',
    params: {
      page,
      limit,
      key
    }
  })
}

const getAdministorListByFuzzyQuery = (page, limit, key) => {
  return request('/administor/listByFuzzyQuery', {
    method: 'get',
    params: {
      page,
      limit,
      key
    }
  })
}

const deleteAdministorList = (administorIds) => {
  return request('/administor/delete', {
    method: 'post',
    data: {
      administorIds
    }
  })
}

const getAdministorById = (administorId) => {
  return request({
    url: `/administor/info/${administorId}`,
    method: 'get'
  })
}

const saveOrUpdateAdministor = (administorId, administor) => {
  return request(`/administor/${!administorId ? 'save' : 'update'}`, {
    method: 'post',
    data: administor
  })
}

export { getAdministorList, getAdministorListByFuzzyQuery, deleteAdministorList, getAdministorById, saveOrUpdateAdministor }
